home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9345 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  6.4 KB

  1. Path: news.niestu.com!usenet
  2. From: chipr@niestu.com (Chip Richards)
  3. Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++
  4. Subject: Re: C/C++ knocks the crap out of Ada
  5. Date: 1 Mar 1996 00:48:19 GMT
  6. Organization: NiEstu, Phoenix AZ USA
  7. Message-ID: <4h5hgj$vpd@tomquartz.niestu.com>
  8. References: <00001a73+00002504@msn.com> <4etcmm$lpd@nova.dimensional.com>
  9.   <4f4ptt$a1c@newsbf02.news.aol.com> <4g1b7n$l5@mailhub.scitec.com.au>
  10.   <JSA.96Feb16135027@organon.com> <4gaa6l$8mk@post.gsfc.nasa.gov>
  11.   <4gd94r$isu@mack.rt66.com> <1996Feb22.005518.13396@leeweyr.sccsi.com>
  12.   <4gvrffINNlqo@anvil.ugrad.cs.ubc.ca>
  13. NNTP-Posting-Host: tomquartz.niestu.com
  14. X-Newsreader: knews 0.9.3
  15.  
  16. Sigh.
  17.  
  18. In article <4gvrffINNlqo@anvil.ugrad.cs.ubc.ca>, Kazimir Kylheku writes:
  19.  
  20.    What is intrinsically unsafe about C?
  21.  
  22. Lots of things.  How much time have you?
  23.  
  24. My current employer produces industrial process control systems.  Ada and C
  25. were considered for the implementation back in 1981, but neither was
  26. sufficiently well-supported on the "mandated" hardware, so an extended Pascal
  27. was chosen instead.  That decision has paid off repeatedly in terms of
  28. reliability, which translates directly into a reduction in certain unpleasant
  29. side-effects such as down-time, explosions, lawsuits, and even injuries and
  30. death.
  31.  
  32. The most common failure for one of these control computers is "range check",
  33. which is completely missing from C.  Certainly, a C coder *could* add range
  34. checks, but so could those Pascal programmers.  However, if they had, the
  35. compiler-generated checks would not be triggered.  C programmers, feeling
  36. "close to the hardware" and so often paying homage to the god of "efficiency",
  37. fail to put checks in just as often, but their compiler provides no option for
  38. backing them up in those instances.
  39.  
  40. There actually was an over-zealous vice-president who, upon learning that the
  41. most common error was a range check, suggested that all the range checks be
  42. removed from the code, thus preventing the majority of errors!  Cooler heads,
  43. who understand that it is much better (given the control system architecture)
  44. to simply stop processing than to continue processing with erroneous data,
  45. prevailed, and the range checks are still shipping.
  46.  
  47.    I could write a strict, standard-conforming, anally-retentive program in
  48.    any language that could kill people (maliciously, of course).
  49.  
  50. So you could.  So could I, so could anyone.  What is much more the treat (and
  51. much more difficult) is to write a program (*any* program) which does *not*
  52. kill people, even when it is entrusted with their safety.  The skill lies not
  53. in writing a dangerous program intentionally, but in *not* writing such a
  54. program *unintentionally*.
  55.  
  56.    Software which has life-threatening consequences shoud not be left to
  57.    something that sacrifices intimacy with hardware for some higher purpose
  58.    that has more to do with bureaucracy than anything else.
  59.  
  60. This statement is astounding.  Starting at the end:
  61.  
  62. 1.  "... some higher purpose that has more to do with bureaucracy than
  63. anything else."  I assume this is a jab at Ada.  It's wrong.  If you would
  64. care to correct this mistaken impression, spend a bit of time and learn a
  65. little of the history of the language you attempt to disparage.  Pay special
  66. attention to the birth of Ada95, which has precious little to do with
  67. bureaucracy.  Granted, some design decisions were put into Ada83 (and even a
  68. scant few in Ada95) more to create a pleasing political compromise than a
  69. pleasing technical design.  But there were still sound technical arguments
  70. behind *every* feature.
  71.  
  72. 2.  "... something that sacrifices intimacy with hardware ..."  Ex*cuse* me?
  73. What??  What *are* they teaching in today's schools?  The only hardware C has
  74. anything *like* intimacy with is the PDP-11, its spawning ground.  As a system
  75. programming language for the 11's, it was years ahead of its time--other
  76. system languages of the time (many popular platforms had one) were cumbersome,
  77. primitive, and specialized in the extreme.  But the "intimacy with hardware"
  78. remark could only be applied by someone who hasn't spent much time actually
  79. writing C which is intimate with hardware.  Especially with several different
  80. platforms.  Sigh--more research on your calendar to dispel this particular
  81. myth.
  82.  
  83. 3.  "Software which has life-threatening consequences shoud not be left to
  84. .."  Wow, should not be left to people who hold such astounding
  85. misconceptions, I'd say.
  86.  
  87. In literal point of fact, I agree with this statement.  If it applied to
  88. something in the real world, it would be a rather more interesting statement.
  89.  
  90.    And it should certainly not be written in some poorly standardized language,
  91.    for which no two implementations are in agreement.
  92.  
  93. Agreed, but it's odd that you would set this criterion, since it rules out C
  94. *and* C++, and allows Ada83 and even *begs* for Ada95.  Or did someone rush
  95. out and write a validation suite for C or C++ while we weren't looking?  While
  96. the ACVC is no guarantee of much of anything, it *is* better than, er,
  97. nothing.
  98.  
  99.    C is governed by an ISO standard, which, if adhered to, lets a strictly
  100.    conforming program translated by a strictly conforming implementation yield
  101.    well-defined results.
  102.  
  103. Oh, this is rich!  Have the words "implementation defined" been driven from
  104. that spec?  Have they at least been eliminated from the *important* areas,
  105. like bitfields?  Formality of specification and predictability of results are
  106. attributes that all languages possess to smaller or greater degree; I would
  107. venture to say that C++ exceeds C in these areas, and Ada exceeds C++.  And
  108. Ada could itself stand some work.
  109.  
  110.    I don't think you can say the same for Ada or C++.
  111.  
  112. Well, obviously *you* can't say that about Ada or C++, but only because you
  113. are underinformed.  I can say it fine:  Ada95 is *already* an ISO standard,
  114. and C++ is well along its way to becoming one.
  115.  
  116. BTW, my employer's architects decided that their new control systems should be
  117. written in C/C++.  And for those people who don't think there *is* such a
  118. language as C/C++, I beg to differ.  "C/C++" is that language that is written
  119. mainly using the syntactic rules of C, and compiled with a C++ compiler.  That
  120. way, you can tell your boss and your customer that the system is written in
  121. C++, without the actual pain and fright of OO design and implementation.  And
  122. you can always drop into C when the C++ "isn't suitable" for whatever task you
  123. don't have the schedule to *write*, but must hack up like a furball.
  124.  
  125. --
  126. Chip
  127.  
  128.